﻿
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=yes" />
    <meta name="format-detection" content="email=no" />
    <title>
        勘查信息手机版
    </title>
    <link rel="stylesheet" type="text/css" href="css/css.css" />
    <link rel="stylesheet" type="text/css" href="css/buttons.css" />
    <meta content="勘查信息手机版" name="keywords" />
</head>
<body>
    <div class="tzrl_box">
        <div class="mq_top">
            <div class="btn_back_l">
                <a class="btn_back" onclick="history.go(-1)">
                    <span></span>
                    <nav>返回</nav>
                </a>
            </div>
            <div class="mq_title">
                询价记录
            </div>
            <div class="btn_ch_r">
            </div>
        </div>
        <div class="job_content">
            <div class="d_description">
                <h3 class="d_title">
                    基本信息
                </h3>
                <div class="d_pos_box">
                    <form id="addform">
                        <dl>
                            <dt>建议评估单价：</dt>
                            <dd>
                                <input name="P_ReportNumber" class="input_boxfield" id="P_ReportNumber" type="hidden" />
                                <input name="P_proposal" class="input_boxfield" id="P_proposal" value="" placeholder="请输入建议评估单价" type="text" />
                            </dd>
                        </dl>
                        <dl>
                            <dt>勘查日期时间：</dt>
                            <dd>
                                <input name="P_date" class="input_boxfield" id="P_date" value="" placeholder="请输入勘查日期时间" type="text" />
                            </dd>
                        </dl>
                        <dl>
                            <dt>询价记录(列表)：</dt>
                            <dd>
                                <table style="width:100%" id="listTable">
                                    <tr>
                                        <td style="width:60%">
                                            <input name="txt" class="input_boxfield txt" value="" placeholder="请输入询价记录" type="text" style="float:left;" />
                                        </td>
                                        <td style="width:35%">
                                            <button class="button green" id="add" type="button" style="float:left;">新增询价记录</button>
                                        </td>
                                    </tr>
                                </table>
                            </dd>
                            <!--<dd id="">
                                <table style="width:100%">
                                    <tr>
                                        <td style="width:60%">
                                            <input name="txt" class="input_boxfield" id="txt" value="" placeholder="" type="text" style="float:left;" />
                                        </td>
                                        <td style="width:35%">
                                            <button class="button red" id="add" type="button" style="float:left;">删除询价记录</button>
                                        </td>
                                    </tr>
                                </table>
                            </dd>-->
                        </dl>
                        <dl>
                            <dd class="">
                                <button class="button blue" data-id="190317" id="jbSub" type="button">
                                    提交
                                </button>
                            </dd>
                        </dl>
                    </form>
                </div>
            </div>
        </div>
        <div class="footer">
            <div class="footer_top">
                <ul class="user_info">
                    <a href="Index.html">主页</a>
                </ul>
                <ul class="back_top">
                    <a href="javascript:scroll(0,0)">TOP</a>
                </ul>
            </div>
            <ul class="copyright">
                <li>
                    <a href="javascript:;">电脑版</a><span>|</span><a href="javascript:;">普通版</a><span>|</span><a href="javascript:;">用户反馈</a><span>|</span><a href="javascript:;">联系我们</a>
                </li>
                <li>&copy;Copyright 北京中资房产 by 房产估价系统1.0 </li>
            </ul>
        </div>
    </div>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/layer/layer.js"></script>
    <script type="text/javascript" src="writeJS/WebApi.js"></script>
    <script type="text/javascript">
        $(function () {
            var d = new Date();
            $("#P_date").val(d.getFullYear() + "/" + d.getMonth() + "/" + d.getDate());
            var uri = document.location.search;//接收页面传值
            var i = uri.lastIndexOf("?") + 1;//获取问号前面的值
            var P_ReportNumber11 = uri.substr(i);//截取问号前面的值

            $.ajax({
                type: "get",
                url: ApiUrl + "api/InquiryRecord/GetInquiryRecord",
                data: { P_ReportNumber: P_ReportNumber11 },
                success: function (data, status) {
                    if (status == "success") {
                        $("#P_proposal").val(data.tp.P_proposal);
                        $("#P_date").val(data.tp.P_date)
                      //  $("#listTable").empty();
                        $(data.ltp).each(function (i, item)
                        {
                            var html = ""
                   + "    <dd id=\"tb" + i + "\">"
                   + "        <table style=\"width:100%\">"
                   + "            <tr>"
                   + "                <td style=\"width:60%\">"
                   + "                    <input name=\"txt\" value=\"" + item.t_iname + "\" class=\"input_boxfield txt\" placeholder=\"请输入询价记录\" type=\"text\" style=\"float:left;\" />"
                   + "                </td>"
                   + "                <td style=\"width:35%\">"
                   + "                    <button onclick=\"Remo('tb" + i + "')\" class=\"button red\" type=\"button\" style=\"float:left;\">删除询价记录</button>"
                   + "                </td>"
                   + "            </tr>"
                   + "        </table>"
                   + "    </dd>";
                            $("#listTable").parent().append(html);
                        })
                    }
                },
                error: function (e) {
                    layer.msg('服务器链接超时!', { icon: 0, time: 1000 });
                },
                complete: function () {

                }
            })

            var i = 0;
            $("#add").click(function () {
                i++;
                var html = ""
                    + "    <dd id=\"tb" + i + "\">"
                    + "        <table style=\"width:100%\">"
                    + "            <tr>"
                    + "                <td style=\"width:60%\">"
                    + "                    <input name=\"txt\" class=\"input_boxfield txt\" placeholder=\"请输入询价记录\" type=\"text\" style=\"float:left;\" />"
                    + "                </td>"
                    + "                <td style=\"width:35%\">"
                    + "                    <button onclick=\"Remo('tb" + i + "')\" class=\"button red\" type=\"button\" style=\"float:left;\">删除询价记录</button>"
                    + "                </td>"
                    + "            </tr>"
                    + "        </table>"
                    + "    </dd>";
                $("#listTable").parent().append(html);
            })
            $("#jbSub").click(function () {
                var arr = [];
                $(".txt").each(function () {
                    arr.push(this.value);
                })
                var uri = document.location.search;//接收页面传值
                var i = uri.lastIndexOf("?") + 1;//获取问号前面的值
                var P_ReportNumber11 = uri.substr(i);//截取问号前面的值
                var parms = {

                    P_ReportNumber: P_ReportNumber11,
                    P_proposal: $("#P_proposal").val(),        // --项目案名
                    P_date: $("#P_date").val(),      // --来源编号
                    txt: arr
                };
                $.ajax({
                    type: "post",
                    url: ApiUrl + "api/InquiryRecord/InsertInquiryRecord",
                    data: parms,
                    success: function (data, status) {
                        if (status == "success") {
                            if (data == true) {
                                layer.msg('保存成功!', { icon: 1, time: 1000 });

                            }
                            else {
                                layer.msg('保存失败!', { icon: 2, time: 1000 });
                            }
                        }
                    },
                    error: function (e) {
                        layer.msg('服务器链接超时!', { icon: 0, time: 1000 });
                    },
                    complete: function () {

                    }
                })
            })
        })
        function Remo(obj) {
            //alert(obj);
            $("#" + obj).empty();
        }
    </script>
</body>
</html>
